/**
 * 2017年5月1日
 */
package cn.edu.bjtu.entity.impl.api;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.locks.ReadWriteLock;

import cn.edu.bjtu.entity.impl.BaseSimpleContext;
import cn.edu.bjtu.settings.ApplicationConfiguration;

/**
 * @author Alex
 *
 */
public abstract class Word2VecBaseContext<R> extends BaseSimpleContext<R> {
	/**
	 * resultMap.put(Constant.COMMANT_RESULT,List)
	 * 在jsp tag中顺序把list输出,然后里面的元素用div包含
	 */
	protected Map<String,Object> resultMap = new TreeMap<String,Object>();
	/**
	 * @param lock
	 */
	public Word2VecBaseContext(ReadWriteLock lock) {
		super(lock);
	}

	@Override
	public String getHostname() {
//		return "localhost";
		return ApplicationConfiguration.getInstance().getProperty("WORD2VEC_HOST");
	}
	public void printStream( InputStream in) throws IOException{
		BufferedReader br  = new BufferedReader(new InputStreamReader(in, "utf-8"));
		String line = "";
		while((line=br.readLine())!=null){
			System.out.println(line);
		}
	}

}
